package site.yunnong.atvris.portal.controller;

import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import site.yunnong.atvris.common.api.ResultVO;
import site.yunnong.atvris.portal.service.PartitionService;

import javax.annotation.Resource;


/**
 * 分区表
 *
 * @author zhangjinghao
 * @email jhzhang9102@163.com
 * @date 2021-07-09 23:45:38
 */
@RestController
@RequestMapping("/partition")
public class MediaPartitionController {

    @Resource
    private PartitionService partitionService;

    /**
     * 列表
     */
    @ApiOperation("查询指定父分区下的分区")
    @GetMapping("/list")
    public ResultVO list(@RequestParam Long parentId){
        return new ResultVO().success(partitionService.queryByParentId(parentId));
    }

    @ApiOperation("查询分区列表(分级)")
    @GetMapping("/list/with-children")
    public ResultVO listWithChildren(){
        return new ResultVO().success(partitionService.listWithChildren());
    }

    @ApiOperation("查询一级分区目录")
    @GetMapping("/first-level")
    public ResultVO firstLevelPartition() {
        return new ResultVO().success(partitionService.firstLevelPartition());
    }
    


}
